//
//  CZBottomView.swift
//  SinaBlog
//
//  Created by 李超 on 16/3/25.
//  Copyright © 2016年 lichao. All rights reserved.
//

import UIKit

class CZBottomView: UIView {
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override init(frame: CGRect) {
        super.init(frame: frame)
        //backgroundColor = UIColor.purpleColor()
        prepareUI()
    }

    func prepareUI(){
        //添加子控件
        addSubview(repostButton)
        addSubview(commentButton)
        addSubview(thumbsUpButton)
        addSubview(firstLine)
        addSubview(secondLine)
        //添加子控件的约束
        //转发按钮的约束
        repostButton.snp_makeConstraints { (make) -> Void in
            
            make.top.leading.bottom.equalTo(self)
            //make.width.equalTo(commentButton)
            
        }
        //评论按钮的约束
        commentButton.snp_makeConstraints { (make) -> Void in
            
            make.top.bottom.equalTo(self)
            make.leading.equalTo(repostButton.snp_trailing)
            make.width.equalTo(thumbsUpButton)
        }
        //点赞按钮的约束
        thumbsUpButton.snp_makeConstraints { (make) -> Void in
            
            make.top.bottom.trailing.equalTo(self)
            make.leading.equalTo(commentButton.snp_trailing)
            make.width.equalTo(repostButton)
        }
        //第一根线约束
        firstLine.snp_makeConstraints { (make) -> Void in
            
            make.centerX.equalTo(commentButton.snp_leading)
            make.centerY.equalTo(self)
        }
        //第二根线的约束
        secondLine.snp_makeConstraints { (make) -> Void in
            
            make.centerY.equalTo(self)
            make.centerX.equalTo(commentButton.snp_trailing)
        }
        
        
    }
    //微博转发按钮
    private lazy var repostButton:UIButton = UIButton(titlt: "转发", imageName: "timeline_icon_retweet", bgImageName: "timeline_card_bottom_background", target: self, action: "repostButtonAction", event: UIControlEvents.TouchUpInside)
    //评论按钮
    private lazy var commentButton:UIButton = UIButton(titlt: "评论", imageName: "timeline_icon_comment", bgImageName: "timeline_card_bottom_background", target: self, action: "commentButtonAction", event: UIControlEvents.TouchUpInside)
    //点赞按钮
    private lazy var thumbsUpButton:UIButton = UIButton(titlt: "赞", imageName: "timeline_icon_like", bgImageName: "timeline_card_bottom_background", target: self, action: "thumbsUpButtonAction", event: UIControlEvents.TouchUpInside)
    private lazy var firstLine:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    private lazy var secondLine:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    
    
    //微博转发按钮触发的方法
    func repostButtonAction(){
      print("\(__FUNCTION__)")
    }
    //评论按钮触发的方法
    func commentButtonAction(){
      print("\(__FUNCTION__)")
        
    }
    //点赞按钮触发的按钮
    func thumbsUpButtonAction(){
      print("\(__FUNCTION__)")
    }
    
    
    
}
